/*
 * @Author: folusGan 245942153@qq.com
 * @Date: 2024-10-08 15:17:31
 * @LastEditors: folusGan 245942153@qq.com
 * @LastEditTime: 2024-10-10 17:35:48
 * @Description:
 */
import Cookies from 'js-cookie'
import { getLanguage } from '@/lang/index'

const state = {
  language: getLanguage(),
}

const mutations = {
  SET_LANGUAGE: (state, language) => {
    state.language = language
    Cookies.set('language', language)
  },
}

const actions = {
  setLanguage({ commit }, language) {
    commit('SET_LANGUAGE', language)
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
}
